//------------------------------------------------------------------------------------
#include "CSnakeHead.h"
#include "common.h"
//------------------------------------------------------------------------------------
CSnakeHead::CSnakeHead(void) : CMoveSprite() {
    tete=QImage(":/snake/images/tete.png");
}
//------------------------------------------------------------------------------------
void CSnakeHead::draw(QPainter *painter, int idxImage) {
	QRect reg(idxImage*CELL_WIDTH, 0, CELL_WIDTH, CELL_HEIGHT);
	QImage teteReg=tete.copy(reg);
    QMatrix matrix;
    QPoint p(getPosition());

    matrix.rotate(getIncY() > 0 ? 180 : getIncX() < 0 ? -90 : getIncX() > 0 ? 90 : 0);
    CSprite::draw(painter, teteReg.transformed(matrix));
}
//------------------------------------------------------------------------------------
